package com.ef.domain;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.ef.constant.ECLTCourseCategory;
import com.ef.constant.EContractState;
import com.ef.constant.EPayMethod;
import com.ef.constant.StatusType;

@Entity
public class CorpContract implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;

	@Enumerated(value = EnumType.STRING)
	private StatusType status = StatusType.VALID;
	
	@Enumerated(value = EnumType.STRING)
	private ECLTCourseCategory course;
	

	@Column(length = 100)
	private String contractNo;

	@ManyToOne(fetch = FetchType.LAZY)
	private Company company;

	@Temporal(TemporalType.TIMESTAMP)
	private Date startTime;

	@Temporal(TemporalType.TIMESTAMP)
	private Date endTime;

	private Double price;
	
	private Double testingFee;
	
	private Double transportationFee;
	
	private Double materialFee;
	
	private Double trainingFee;

	@Enumerated(value = EnumType.STRING)
	private EContractState contractState;

	@Enumerated(value = EnumType.STRING)
	private EPayMethod payMethod;

	@Column(length = 1000)
	private String comments;

	@ManyToOne(fetch = FetchType.EAGER)
	private User createUser;

	@Temporal(TemporalType.TIMESTAMP)
	private Date createTime;

	@ManyToOne(fetch = FetchType.EAGER)
	private User commitUser;

	@Temporal(TemporalType.TIMESTAMP)
	private Date commitTime;

	@Temporal(TemporalType.TIMESTAMP)
	private Date finishTime;

	@ManyToOne(fetch = FetchType.EAGER)
	private User finishUser;

	private Double paidMoney;

	@ManyToOne(fetch = FetchType.LAZY)
	private User updateUser;

	@Temporal(TemporalType.TIMESTAMP)
	private Date updateTime;

	public String getComments() {
		return comments;
	}

	public void setComments(String comments) {
		this.comments = comments;
	}

	public EContractState getContractState() {
		return contractState;
	}

	public void setContractState(EContractState contractState) {
		this.contractState = contractState;
	}

	public EPayMethod getPayMethod() {
		return payMethod;
	}

	public void setPayMethod(EPayMethod payMethod) {
		this.payMethod = payMethod;
	}

	public String getContractNo() {
		return contractNo;
	}

	public void setContractNo(String contractNo) {
		this.contractNo = contractNo;
	}

	public Date getStartTime() {
		return startTime;
	}

	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}

	public Date getEndTime() {
		return endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Double getPrice() {
		return price;
	}

	public void setPrice(Double price) {
		this.price = price;
	}

	public StatusType getStatus() {
		return status;
	}

	public String getContractStateMsg() {
		if (contractState != null) {
			return contractState.toString();
		}
		return "";
	}

	public void setStatus(StatusType status) {
		this.status = status;
	}

	public User getCreateUser() {
		return createUser;
	}

	public void setCreateUser(User createUser) {
		this.createUser = createUser;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public User getCommitUser() {
		return commitUser;
	}

	public void setCommitUser(User commitUser) {
		this.commitUser = commitUser;
	}

	public Date getCommitTime() {
		return commitTime;
	}

	public void setCommitTime(Date commitTime) {
		this.commitTime = commitTime;
	}

	public Double getPaidMoney() {
		return paidMoney;
	}

	public void setPaidMoney(Double paidMoney) {
		this.paidMoney = paidMoney;
	}

	public Date getFinishTime() {
		return finishTime;
	}

	public void setFinishTime(Date finishTime) {
		this.finishTime = finishTime;
	}

	public User getFinishUser() {
		return finishUser;
	}

	public void setFinishUser(User finishUser) {
		this.finishUser = finishUser;
	}

	public User getUpdateUser() {
		return updateUser;
	}

	public void setUpdateUser(User updateUser) {
		this.updateUser = updateUser;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public Company getCompany() {
		return company;
	}

	public void setCompany(Company company) {
		this.company = company;
	}

	public Double getTestingFee() {
		return testingFee;
	}

	public void setTestingFee(Double testingFee) {
		this.testingFee = testingFee;
	}

	public Double getTransportationFee() {
		return transportationFee;
	}

	public void setTransportationFee(Double transportationFee) {
		this.transportationFee = transportationFee;
	}

	public Double getMaterialFee() {
		return materialFee;
	}

	public void setMaterialFee(Double materialFee) {
		this.materialFee = materialFee;
	}

	public Double getTrainingFee() {
		return trainingFee;
	}

	public void setTrainingFee(Double trainingFee) {
		this.trainingFee = trainingFee;
	}

	public ECLTCourseCategory getCourse() {
		return course;
	}

	public void setCourse(ECLTCourseCategory course) {
		this.course = course;
	}
}
